from django.urls import path
from django.contrib.auth import views as auth_views
from . import views

app_name = 'dashboard'

urlpatterns = [
    # 登录和用户认证
    path('login/', views.custom_login, name='login'),
    path('logout/', auth_views.LogoutView.as_view(next_page='dashboard:login'), name='logout'),
    
    # 仪表盘首页
    path('', views.dashboard_home, name='home'),
    
    # 菜品管理
    path('foods/', views.food_list, name='food_list'),
    path('foods/add/', views.food_edit, name='food_add'),
    path('foods/edit/<int:food_id>/', views.food_edit, name='food_edit'),
    path('foods/delete/<int:food_id>/', views.food_delete, name='food_delete'),
    
    # 订单管理
    path('orders/', views.order_list, name='order_list'),
    path('orders/<int:order_id>/', views.order_detail, name='order_detail'),
    path('orders/update-status/<int:order_id>/', views.order_update_status, name='order_update_status'),
    path('orders/update-status/<int:order_id>/<int:status>/', views.order_update_status_direct, name='order_update_status_direct'),
    path('orders/print/<int:order_id>/', views.order_print, name='order_print'),
    path('orders/export/', views.order_export, name='order_export'),
    path('orders/batch-action/', views.order_batch_action, name='order_batch_action'),
    
    # 分类管理
    path('categories/', views.category_list, name='category_list'),
    path('categories/add/', views.category_edit, name='category_add'),
    path('categories/edit/<int:category_id>/', views.category_edit, name='category_edit'),
    path('categories/delete/<int:category_id>/', views.category_delete, name='category_delete'),
    
    # 用户管理
    path('users/', views.user_list, name='user_list'),
    path('users/add/', views.user_edit, name='user_add'),
    path('users/edit/<int:user_id>/', views.user_edit, name='user_edit'),
    path('users/status/<int:user_id>/', views.user_status_update, name='user_status_update'),
    path('users/delete/<int:user_id>/', views.user_delete, name='user_delete'),
    path('users/batch-action/', views.user_batch_action, name='user_batch_action'),
] 